# -*- coding: UTF-8 -*-

from google.appengine.ext import db

class dsEntitySet(db.Model): 
    primary_key = db.StringProperty()
    parents_key = db.ReferenceProperty()
    entity_keys = db.ListProperty(db.Key)
    
    def PutAll(self):
        entity_list = db.get(self.entity_keys)
        if entity_list:
            for entity in entity_list:
                entity.PutAll()
        self.put()
    def Append(self, entity):
        self.entity_keys.append(entity.key())
    def Remove(self, entity):
        self.entity_keys.remove(entity.key())
    def SetParents(self, entity):
        self.parents_key = entity.key()

class dsConstantEntity(db.Model):
    name = db.StringProperty()
    value = db.StringProperty()
    
    def PutAll(self):
        self.put()
    def SetParents(self, entity):
        self.parents_key = entity.key()
